$(function(){
    var id = getvl("id");
    if (id != '') {
        $.ajax({
            url: urlcore + "/active/get/active/by/admin?id="+id,
            type: "get",
            dataType: 'jsonp',
            contentType: "application/json;charset=utf-8",
            success:function(data){
                if (data.success == true) {
                    var da = data.data;
                    $('#thisId').text(id);
                    var coverUrl = da.coverUrl;
                    var imgStr1 = '';
                    if (coverUrl != null && coverUrl != '') {
                        var imgarr = coverUrl.split("***");
                        $.each(imgarr,function(index,value){
                            imgStr1 += "<img style='padding: 5px 5px 5px 5px;' width='250px' height='250px' src='"+value+"'>";
                        });
                    }
                    $('#coverUrl').html(imgStr1);

                    $('#activeIntroduce').text(da.activeIntroduce);
                    /*$('#realPrice').text(da.realPrice);*/
                    $('#gatherPlace').text(da.gatherPlace);
                    $('#targetPlace').text(da.targetPlace);
                    $('#sales').text(da.sales);

                    $('#activeDetail').html(da.activeDetail);
                    $('#activeScheduling').html(da.activeScheduling);
                    $('#costDescription').html(da.costDescription);

                    var activeUrl = da.activeUrl;
                    var imgStr2 = '';
                    if (activeUrl != null && activeUrl != '') {
                        var imgarr = activeUrl.split("***");
                        $.each(imgarr,function(index,value){
                            imgStr2 += "<img style='padding: 5px 5px 5px 5px;' width='250px' height='250px' src='"+value+"'>";
                        });
                    }
                    $('#activeUrl').html(imgStr2);
                } else if (data.code == 'OVERTIME'){
                    var thisUrl = window.location.href;
                    if (thisUrl.indexOf('login.html') <= -1) {
                        top.window.location.href="login.html";
                    }
                } else {
                    alert(data.msg);
                }
            },
            error:function() {
                /* Act on the event */
                alert("error");
            }
        });
    }

});

function subMsg() {
    var id = $('#thisId').text();
    window.location.href="active_add.html?id="+id;
}